package com.mayuhao.loginmanage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mayuhao.loginmanage.entity.CssMenu;
import com.mayuhao.loginmanage.entity.CssUserRole;
import com.mayuhao.loginmanage.entity.CssUserRoleVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author 马宇豪
 * @since 2022-10-23
 */
@Mapper
public interface CssUserRoleMapper extends BaseMapper<CssUserRole> {

    CssUserRoleVO studentLogin(@Param("userId") String userId, @Param("passWord") String passWord);

    CssUserRoleVO teacherLogin(@Param("userId") String userId, @Param("passWord") String passWord);

    CssUserRoleVO adminLogin(@Param("userId") String userId, @Param("passWord") String passWord);
//    CssUserRoleVO login(@Param("userName") String userName, @Param("passWord") String passWord, @Param("roleId") Integer roleId);

    List<CssMenu> getMenus(@Param("roleId") String roleId);

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName changePassword
     * @params [studentId, newPassword]
     * @paramType [java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/11/12 0012 下午 2:32
     * @email 1757442521@qq.com
     **/
    @Update("UPDATE css_student SET student_password = #{newPassword} WHERE student_id=#{studentId}")
    boolean changeStudentPassword(@Param("studentId") String studentId, @Param("newPassword") String newPassword);

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName changeTeacherPassword
     * @params [teacherId, newPassword]
     * @paramType [java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/11/12 0012 下午 2:51
     * @email 1757442521@qq.com
     **/
    @Update("UPDATE css_teacher SET teacher_password = #{newPassword} WHERE teacher_id=#{teacherId}")
    boolean changeTeacherPassword(@Param("teacherId") String teacherId, @Param("newPassword") String newPassword);

    /**
     * @return boolean
     * @description 请修改方法描述
     * @methodName changeAdminPassword
     * @params [adminId, newPassword]
     * @paramType [java.lang.String, java.lang.String]
     * @author 马宇豪
     * @date 2022/11/12 0012 下午 2:56
     * @email 1757442521@qq.com
     **/
    @Update("UPDATE css_admin SET admin_password = #{newPassword} WHERE admin_id=#{adminId}")
    boolean changeAdminPassword(@Param("adminId") String adminId, @Param("newPassword") String newPassword);
}
